<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content=
    "application/xhtml+xml; charset=iso-8859-1" />
    <title>
      Lua-5.2.4
    </title>
    <link rel="stylesheet" type="text/css" href="../stylesheets/lfs.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="stylesheet" href="../stylesheets/lfs-print.css" type=
    "text/css" media="print" />
  </head>
  <body class="blfs" id="blfs-2020-04-02">
    <div class="navheader">
      <h4>
        Beyond Linux<sup>�</sup> From Scratch <span class="phrase">(System
        V</span> Edition) - Version 2020-04-02
      </h4>
      <h3>
        Chapter&nbsp;13.&nbsp;Programming
      </h3>
      <ul>
        <li class="prev">
          <a accesskey="p" href="lua.html" title="Lua-5.3.5">Prev</a>
          <p>
            Lua-5.3.5
          </p>
        </li>
        <li class="next">
          <a accesskey="n" href="mercurial.html" title=
          "Mercurial-5.3.1">Next</a>
          <p>
            Mercurial-5.3.1
          </p>
        </li>
        <li class="up">
          <a accesskey="u" href="prog.html" title=
          "Chapter&nbsp;13.&nbsp;Programming">Up</a>
        </li>
        <li class="home">
          <a accesskey="h" href="../index.html" title=
          "Beyond Linux� From Scratch     (System V Edition) - Version 2020-04-02">
          Home</a>
        </li>
      </ul>
    </div>
    <div class="sect1" lang="en" xml:lang="en">
      <h1 class="sect1">
        <a id="lua52" name="lua52"></a>Lua-5.2.4
      </h1>
      <div class="package" lang="en" xml:lang="en">
        <h2 class="sect2">
          Introduction to Lua 5.2
        </h2>
        <p>
          <span class="application">Lua</span> is a powerful light-weight
          programming language designed for extending applications. It is
          also frequently used as a general-purpose, stand-alone language.
          <span class="application">Lua</span> is implemented as a small
          library of C functions, written in ANSI C, and compiles unmodified
          in all known platforms. The implementation goals are simplicity,
          efficiency, portability, and low embedding cost. The result is a
          fast language engine with small footprint, making it ideal in
          embedded systems too.
        </p>
        <p>
          This is an older verion of <span class="application">Lua</span>
          needed only for compatibility with other programs such as <a class=
          "xref" href="../basicnet/wireshark.html" title=
          "Wireshark-3.2.2">Wireshark-3.2.2</a>.
        </p>
        <p>
          This package is known to build and work properly using an LFS-9.1
          platform.
        </p>
        <h3>
          Package Information
        </h3>
        <div class="itemizedlist">
          <ul class="compact">
            <li class="listitem">
              <p>
                Download (HTTP): <a class="ulink" href=
                "http://www.lua.org/ftp/lua-5.2.4.tar.gz">http://www.lua.org/ftp/lua-5.2.4.tar.gz</a>
              </p>
            </li>
            <li class="listitem">
              <p>
                Download MD5 sum: 913fdb32207046b273fdb17aad70be13
              </p>
            </li>
            <li class="listitem">
              <p>
                Download size: 248 KB
              </p>
            </li>
            <li class="listitem">
              <p>
                Estimated disk space required: 3.6 MB
              </p>
            </li>
            <li class="listitem">
              <p>
                Estimated build time: less than 0.1 SBU
              </p>
            </li>
          </ul>
        </div>
        <h3>
          Additional Downloads
        </h3>
        <div class="itemizedlist">
          <ul class="compact">
            <li class="listitem">
              <p>
                Required patch: <a class="ulink" href=
                "http://www.linuxfromscratch.org/patches/blfs/svn/lua-5.2.4-shared_library-1.patch">
                http://www.linuxfromscratch.org/patches/blfs/svn/lua-5.2.4-shared_library-1.patch</a>
              </p>
            </li>
          </ul>
        </div>
        <p class="usernotes">
          User Notes: <a class="ulink" href=
          "http://wiki.linuxfromscratch.org/blfs/wiki/lua">http://wiki.linuxfromscratch.org/blfs/wiki/lua</a>
        </p>
      </div>
      <div class="installation" lang="en" xml:lang="en">
        <h2 class="sect2">
          Installation of Lua 5.2
        </h2>
        <p>
          Some packages check for the <span class=
          "application">pkg-config</span> file for <span class=
          "application">Lua</span>, which is created with:
        </p>
        <pre class="userinput">
<kbd class="command">cat &gt; lua.pc &lt;&lt; "EOF"
<code class="literal">V=5.2
R=5.2.4

prefix=/usr
INSTALL_BIN=${prefix}/bin
INSTALL_INC=${prefix}/include/lua5.2
INSTALL_LIB=${prefix}/lib
INSTALL_MAN=${prefix}/share/man/man1
INSTALL_LMOD=${prefix}/share/lua/${V}
INSTALL_CMOD=${prefix}/lib/lua/${V}
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include/lua5.2

Name: Lua
Description: An Extensible Extension Language
Version: ${R}
Requires:
Libs: -L${libdir} -llua -lm -ldl
Cflags: -I${includedir}</code>
EOF</kbd>
</pre>
        <p>
          Install <span class="application">Lua</span> by running the
          following commands:
        </p>
        <pre class="userinput">
<kbd class=
"command">patch -Np1 -i ../lua-5.2.4-shared_library-1.patch &amp;&amp;

sed -i '/#define LUA_ROOT/s:/usr/local/:/usr/:' src/luaconf.h &amp;&amp;

sed -r -e '/^LUA_(SO|A|T)=/ s/lua/lua5.2/' \
       -e '/^LUAC_T=/ s/luac/luac5.2/'     \
       -i src/Makefile &amp;&amp;

make MYCFLAGS="-fPIC" linux</kbd>
</pre>
        <p>
          The installation of this package is complex, so we will use the
          DESTDIR method of installation:
        </p>
        <pre class="userinput">
<kbd class="command">make TO_BIN='lua5.2 luac5.2'                     \
     TO_LIB="liblua5.2.so liblua5.2.so.5.2 liblua5.2.so.5.2.4" \
     INSTALL_DATA="cp -d"                        \
     INSTALL_TOP=$PWD/install/usr                \
     INSTALL_INC=$PWD/install/usr/include/lua5.2 \
     INSTALL_MAN=$PWD/install/usr/share/man/man1 \
     install &amp;&amp;

install -Dm644 lua.pc install/usr/lib/pkgconfig/lua52.pc &amp;&amp;

mkdir -pv install/usr/share/doc/lua-5.2.4 &amp;&amp;
cp -v doc/*.{html,css,gif,png} install/usr/share/doc/lua-5.2.4 &amp;&amp;

ln -s liblua5.2.so install/usr/lib/liblua.so.5.2   &amp;&amp;
ln -s liblua5.2.so install/usr/lib/liblua.so.5.2.4 &amp;&amp;

mv install/usr/share/man/man1/{lua.1,lua52.1} &amp;&amp;
mv install/usr/share/man/man1/{luac.1,luac52.1}</kbd>
</pre>
        <p>
          Now, as the <code class="systemitem">root</code> user:
        </p>
        <pre class="root">
<kbd class="command">chown -R root:root install  &amp;&amp;
cp -a install/* /</kbd>
</pre>
      </div>
      <div class="commands" lang="en" xml:lang="en">
        <h2 class="sect2">
          Command Explanations
        </h2>
        <p>
          <span class="command"><strong>sed -i ...
          src/luaconf.h</strong></span>: This command changes the
          <span class="application">Lua</span> search path to match the
          install path.
        </p>
        <p>
          <span class="command"><strong>sed -i ...
          src/Makefile</strong></span>: This command deconflicts this
          installation with the latest version of lua.
        </p>
      </div>
      <div class="content" lang="en" xml:lang="en">
        <h2 class="sect2">
          Contents
        </h2>
        <div class="segmentedlist">
          <div class="seglistitem">
            <div class="seg">
              <strong class="segtitle">Installed Programs:</strong>
              <span class="segbody">lua52 and luac52</span>
            </div>
            <div class="seg">
              <strong class="segtitle">Installed Library:</strong>
              <span class="segbody">liblua5.2.so</span>
            </div>
            <div class="seg">
              <strong class="segtitle">Installed Directories:</strong>
              <span class="segbody">/usr/include/lua5.2, /usr/lib/lua/5.2,
              /usr/share/doc/lua-5.2.4, and /usr/share/lua/5.2</span>
            </div>
          </div>
        </div>
        <div class="variablelist">
          <h3>
            Short Descriptions
          </h3>
          <table border="0" class="variablelist">
            <colgroup>
              <col align="left" valign="top" />
              <col />
            </colgroup>
            <tbody>
              <tr>
                <td>
                  <p>
                    <a id="lua52-prog" name="lua52-prog"></a><span class=
                    "term"><span class=
                    "command"><strong>lua5.2</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is the standalone Lua version 5.2 interpreter.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="luac52" name="luac52"></a><span class=
                    "term"><span class=
                    "command"><strong>luac5.2</strong></span></span>
                  </p>
                </td>
                <td>
                  <p>
                    is the Lua version 5.2 compiler.
                  </p>
                </td>
              </tr>
              <tr>
                <td>
                  <p>
                    <a id="liblua52" name="liblua52"></a><span class=
                    "term"><code class="filename">liblua5.2.so</code></span>
                  </p>
                </td>
                <td>
                  <p>
                    contains the <span class="application">Lua</span> version
                    5.2 API functions.
                  </p>
                </td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
      <p class="updated">
        Last updated on 2020-03-12 04:24:44 -0500
      </p>
    </div>
    <div class="navfooter">
      <ul>
        <li class="prev">
          <a accesskey="p" href="lua.html" title="Lua-5.3.5">Prev</a>
          <p>
            Lua-5.3.5
          </p>
        </li>
        <li class="next">
          <a accesskey="n" href="mercurial.html" title=
          "Mercurial-5.3.1">Next</a>
          <p>
            Mercurial-5.3.1
          </p>
        </li>
        <li class="up">
          <a accesskey="u" href="prog.html" title=
          "Chapter&nbsp;13.&nbsp;Programming">Up</a>
        </li>
        <li class="home">
          <a accesskey="h" href="../index.html" title=
          "Beyond Linux� From Scratch     (System V Edition) - Version 2020-04-02">
          Home</a>
        </li>
      </ul>
    </div>
  </body>
</html>
